<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Rag Hu
 * Created Time: 2019/8/5 16:01
 * Modified Time: 2019/8/5 16:01
 * Version: 2.0
 */

namespace App\Modules\Store\Repositories;


use App\Models\StorePhoto;
use App\Modules\Store\Validators\StorePhotoValidator;
use Flower\Core\Repository\Eloquent\BaseRepository;

class StorePhotoRepository extends BaseRepository
{
    public function model()
    {
        return StorePhoto::class;
    }

    public function validator()
    {
        return StorePhotoValidator::class;
    }

    /**
     * 新增店铺相册
     * @param $store_id
     * @param $image
     * @return mixed
     */
    public function createStorePhoto($store_id, $image)
    {
        $data = [
            'store_id' => $store_id,
            'image' => $image
        ];
        $model = $this->create($data);
        return $model->id;
    }

    public function deleteStorePhoto($id)
    {
        if($this->find($id)){
            $this->delete($id);
        }
    }

}